#include "logindlg.h"
#include "ui_logindlg.h"
#include <QMessageBox>
#include <QLineEdit>

LoginDlg::LoginDlg(QWidget *parent) : QDialog(parent),
                                      ui(new Ui::LoginDlg)
{
    ui->setupUi(this);
    ui->pwdLineEdit->setEchoMode(QLineEdit::Password);
    connect(ui->exitBtn, SIGNAL(clicked(bool)), this, SLOT(close()));
}

void LoginDlg::on_loginBtn_clicked()
{
    if (ui->usrLineEdit->text() == "syy" && ui->pwdLineEdit->text() == "123")
    {
        accept();
    }
    else
    {
        QMessageBox::warning(this, "Warning!", "username or password is invalid", QMessageBox::Yes);
    }
}

LoginDlg::~LoginDlg()
{
    delete ui;
}
